<?php


namespace app\common\service;

use app\admin\model\GlobalConfig as M;

class GlobalConfig
{
    public static function updateConfig($data)
    {
        foreach ($data as $k => $v) {
            if ($k == 'imageFile') continue;
            $info = M::where('k', $k)->find();
            if ($info) {
                $info->v = $v;
                $info->save();
            } else {
                M::create(['k' => $k, 'v' => $v]);
            }
        }
        return [];
    }
}